// import React from 'react';
// import ReactDOM from 'react-dom';

import React from './lib/react';
import ReactDOM from './lib/react-dom';

class Sum extends React.Component {
  constructor(props) {
    super(props);
    this.a = React.createRef();
    this.b = React.createRef();
    this.c = React.createRef();
  }

  add = () => {
    const a = this.a.current.value;
    const b = this.b.current.value;

    this.c.current.value = a + b;
  }

  render() {
    return (
      <div>
        <input ref={this.a} />
        +
        <input ref={this.b} />
        =
        <input ref={this.c} />
        <div><button onClick={this.add}>执行</button></div>
      </div>
    )
  }
}

ReactDOM.render(
  <Sum/>,
  document.getElementById('root')
);

// 注意如果要使用老的把 jsx 编译成 React.createElement(), 必须在启动项中设置 cross-env DISABLE_NEW_JSX_TRANSFORM=true
// 如： "start": "cross-env DISABLE_NEW_JSX_TRANSFORM=true react-scripts start",